package tut.Struct.collection.phan1.addMethod;

import java.util.Collection;
import java.util.List;

public class Populator {

	public static void fillIt1(
			Collection ref) {
		//	ref.add(0, new MyClass(4)); // => error
		//=> collection::add(Object)->list::add(int, Object)->arrayList
		//=> ((List) ref).add(0, new MyClass(4));
	}

	public static void fillIt2(
			Collection ref) {
		((List) ref).add(0, new MyClass(4));
		((List) ref).add(1, new MyClass(4));
		((List) ref).add(2, new MyClass(3));
		((List) ref).add(3, new MyClass(2));
		((List) ref).add(4, new MyClass(1));
		// note
		((List) ref).add(3, new MyClass(5));
		// note
	}//end fillIt()
}
